home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 115 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.6 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: "john (j.d.) hickin" <hickin@bnr.ca>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: auto_ptr again
  5. Date: 23 Jan 1996 10:22:44 PST
  6. Organization: Bell-Northern Research
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4e2stq$128@bmtlh10.bnr.ca>
  9. References: <Pine.A32.3.91.960122095620.24366A-100000@zorglub.cae.ca>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=us-ascii
  13. Content-Transfer-Encoding: 7bit
  14. X-Original-Date:  Tue, 23 Jan 1996 14:55:54 +0000 
  15. Content-Identifier:  Re: auto_ptr ... 
  16. X-Mailer: Mozilla 1.1 (X11; I; HP-UX A.09.05 9000/715) 
  17. X-Url: news:Pine.A32.3.91.960122095620.24366A-100000@zorglub.cae.ca 
  18. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  19.     iQBVAwUBMQUnk0y4NqrwXLNJAQHn7wH+O2kBomuJ4xJBOoT8IsNAmEqLLH3+UVwe
  20.     of/HBJMjXuh6kzoDwIoQdBhkfmEq+WbQ9sLJ6SLw4oC9qNhVcjsa1Q==
  21.     =Za6e
  22. Originator: austern@isolde.mti.sgi.com
  23.  
  24. dak wrote:
  25. [text elided]
  26. |> Has it even been discussed ? I do find it quite cynical that this exact
  27. |> choice (temporaries are const) makes it hard to use auto_ptr in return
  28. |> value (and some other uses too in smart pointer), while most compiler have
  29. |> a switch to allow non-const temporaries (and thus disabling any protection
  30. |> from unexpected conversion on function argument that was the original
  31. |> intent).
  32.  
  33. Perhaps the assumptions underlying the original decree are no longer valid
  34. because of the extra control over conversions available in 'standard C++'.
  35.  
  36. Permit me to open a can of worms...
  37.  
  38. I can implement a version of auto_ptr that is fully const correct because the
  39. implementation uses a pointer to a pointer to hold onto the basic resource.
  40.  
  41. One could, therefore, argue that because a const correct implementation can
  42. exist that an implementation with the same observables, but with const
  43. correctness twisted a bit, should be OK.  (See note 1 below).
  44.  
  45. One could also turn this about-face; the net result of banishing the proposed
  46. hackery being an argument in favour of deep const.  I warned you about a can of
  47. worms!
  48.  
  49. J.
  50.  
  51.  
  52. Notes:
  53. -----
  54.  
  55. 1. As far as I can see, true const correctness with a pointer-to-pointer
  56.    implementation might require bounding the number of auto_ptr instances.
  57.    The implementation, therefore, would not quite live up to the spec for
  58.    auto_ptr (but in any practical system there will be an upper bound).
  59.  
  60. -- 
  61. John Hickin      Bell-Northern Research, Montreal, Quebec
  62. (514) 765-7924   hickin@bnr.ca
  63. ---
  64. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  65.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  66.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  67.